
foreground = Color(255, 255, 255, 255)
textColor = Color(255, 255, 255, 255)
textHoverColor = Color(184, 184, 184, 255)
background = Color(122,122,122,255)
 
modelbg = Color(0, 0, 0, 225)
 
btnWidth = 140
btnHeight = 45
btnFont = "Trebuchet24"
 
yPos = ScrH() / 2 -260
xPos = ScrW() / 2 -475
 
centerY = ScrH() / 2
centerX = ScrW() / 2



desc_hider = "What ever you do make sure to get off the ground! Try to complete a jump before the \nSeekers come and find you! Use your grenades to makes the Seekers fall/take damage or \nhopefully die! Stick with your teammates to help increase your chances of surviving,\nnobody likes being a seeker!"
desc_seeker = "SEEK AND DESTROY! Better have your Air Jordan's on you will be doing a lot of jumping!\nYou will spawn with only a knife and will try to hunt down the Hiders. Be careful the Hiders \nhave Flash Bangs, Grenades, and Freeze Grenades try to not find yourself between one \nof them! What ever you do don't fall!"
desc_builder = "This is how we place the blocks and make all of the jumps. This is reserved for Admins or \ntrusted builders ONLY. **Server Owners** simply create group called builder and players in \nthat group will have acesss to building."
desc_spec = "Don't feel like playing? Or do you just want to be a stalker like Jake? Or even of you want \nto take notes on Swifty's awesome skills, this is the place for you!"



usermessage.Hook("F1Menu", function(um)  
	TeamSelection_Open = !TeamSelection_Open

    if TeamSelection_Open then	
		Frame = vgui.Create( "DFrame" )
        Frame:SetSize( ScrW(), ScrH() )
        Frame:SetTitle( "" )
		Frame:SetDraggable(false)
		Frame:ShowCloseButton(false)
		Frame.Paint = function() end
        Frame:SetVisible(true)
        Frame:MakePopup()
		Frame:SetMouseInputEnabled( true )
		
		--Hider button
        button_hiders = vgui.Create( "DButton", Frame )
        button_hiders:SetSize( btnWidth, btnHeight)
        button_hiders:SetPos( xPos, yPos)
		button_hiders:SetColor( textColor )
        button_hiders:SetFont( btnFont )
        button_hiders:SetText( "HIDERS" )
		--Seeker button
        button_seekers = vgui.Create( "DButton", Frame )
        button_seekers:SetSize( btnWidth, btnHeight)
        button_seekers:SetPos( xPos, yPos + 55)
		button_seekers:SetColor( textColor )
        button_seekers:SetFont( btnFont )
        button_seekers:SetText( "SEEKERS" )
		--Spectate button
		button_spec = vgui.Create( "DButton", Frame )
        button_spec:SetSize( btnWidth, btnHeight)
        button_spec:SetPos( xPos, yPos + 470)
		button_spec:SetColor( textColor )
        button_spec:SetFont( btnFont )
        button_spec:SetText( "SPECTATE" )
		--Builder button
		button_builder = vgui.Create( "DButton", Frame )
        button_builder:SetSize( btnWidth, btnHeight)
        button_builder:SetPos( xPos + 661, yPos + 526 )
		button_builder:SetColor( textColor )
        button_builder:SetFont( btnFont )
        button_builder:SetText( "BUILDER" )
		
		modelButton = vgui.Create( "DModelPanel" )
        modelButton:SetModel( "models/player/gman_high.mdl" )
        modelButton:SetSize( 2100, 700)
        modelButton:Center()
        modelButton:SetPos (centerX -ScrW() / 2, centerY -260)
        modelButton:SetCamPos( Vector( 180, 180, 180 ) )
        modelButton:SetLookAt( Vector( 0, 0, 0 ) )
        modelButton:SetVisible(false)
		
		Description = vgui.Create("DLabel", Frame)
		Description:SetPos( xPos +173,yPos +414 )
		Description:SetColor(Color(255,255,255,255))
		Description:SetFont( "MenuFont4" )
		Description:SetText( "Select a Team!" )
		Description:SizeToContents()
			
    end
	
------------------------------------------------------------------   Mouse stuff =X        ------------------------------------------------------------------
------------------------------------------------------------------   This is UGLYYYYYYYY   ------------------------------------------------------------------
------------------------------------------------------------------   I am really sorry     ------------------------------------------------------------------


--Hider Button
	    function button_hiders:OnCursorEntered()
                button_hiders:SetColor( textHoverColor )
                surface.PlaySound( "/UI/buttonrollover.wav" )
                modelButton:SetVisible(true)
				Description:SetText( desc_hider )
				Description:SizeToContents()
            end
         
        function button_hiders:OnCursorExited()
                button_hiders:SetColor( textColor )
                modelButton:SetVisible(false)
				Description:SetText("Select a Team!")
				Description:SizeToContents()
            end
         
        function button_hiders:OnMousePress()
                surface.PlaySound( "/UI/buttonclick.wav" )
            end
         
                button_hiders.DoClick = function ()
                if team.NumPlayers( TEAM_HIDER ) > team.NumPlayers( TEAM_SEEKER ) then 
				notification.AddLegacy("Too many players on that team!", NOTIFY_ERROR, 5)
				surface.PlaySound( "common/bugreporter_failed.wav" )
				else
                surface.PlaySound( "/UI/buttonclickrelease.wav" )
                TeamSelection_Open = false
				Frame:Close()
				modelButton:SetVisible(false)
				LocalPlayer():ConCommand( "SetHider" )
				LocalPlayer():ConCommand("say", "SetHider")
				end
                    end
 
                button_hiders.Paint = function()
                surface.SetDrawColor( background )
                surface.DrawRect( 0, 0, btnWidth, btnHeight)
                surface.SetDrawColor( foreground )
                surface.DrawOutlinedRect( 0, 0, btnWidth, btnHeight )
                surface.DrawOutlinedRect( 1, 1, btnWidth-2, btnHeight-2 )
                surface.DrawOutlinedRect( 2, 2, btnWidth-4, btnHeight-4 )
                    end
					
	
--Seeker Button	
					
	    function button_seekers:OnCursorEntered()
                button_seekers:SetColor( textHoverColor )
                surface.PlaySound( "/UI/buttonrollover.wav" )
                modelButton:SetVisible(true)
				Description:SetText( desc_seeker )
				Description:SizeToContents()				
            end
         
        function button_seekers:OnCursorExited()
                button_seekers:SetColor( textColor )
                modelButton:SetVisible(false)
				Description:SetText("Select a Team!")
				Description:SizeToContents()	
            end
         
        function button_seekers:OnMousePress()
                surface.PlaySound( "/UI/buttonclick.wav" )
            end
         
                button_seekers.DoClick = function ()
                LocalPlayer():ConCommand( "SetSeeker" )
				LocalPlayer():ConCommand("say", "SetSeeker")
                surface.PlaySound( "/UI/buttonclickrelease.wav" )
                TeamSelection_Open = false
				Frame:Close()
				modelButton:SetVisible(false)
                    end
 
                button_seekers.Paint = function()
                surface.SetDrawColor( background )
                surface.DrawRect( 0, 0, btnWidth, btnHeight)
                surface.SetDrawColor( foreground )
                surface.DrawOutlinedRect( 0, 0, btnWidth, btnHeight )
                surface.DrawOutlinedRect( 1, 1, btnWidth-2, btnHeight-2 )
                surface.DrawOutlinedRect( 2, 2, btnWidth-4, btnHeight-4 )
                    end
		

--Spectator Button		
		 function button_spec:OnCursorEntered()
                button_spec:SetColor( textHoverColor )
                surface.PlaySound( "/UI/buttonrollover.wav" )
                modelButton:SetVisible(true)
				Description:SetText( desc_spec )
				Description:SizeToContents()				
            end
         
        function button_spec:OnCursorExited()
                button_spec:SetColor( textColor )
                modelButton:SetVisible(false)
				Description:SetText("Select a Team!")
				Description:SizeToContents()	
            end
         
        function button_spec:OnMousePress()
                surface.PlaySound( "/UI/buttonclick.wav" )
            end
         
                button_spec.DoClick = function ()
                LocalPlayer():ConCommand( "SetSpec" )
                surface.PlaySound( "/UI/buttonclickrelease.wav" )
                TeamSelection_Open = false
				Frame:Close()
				modelButton:SetVisible(false)
                    end
 
                button_spec.Paint = function()
                surface.SetDrawColor( background )
                surface.DrawRect( 0, 0, btnWidth, btnHeight)
                surface.SetDrawColor( foreground )
                surface.DrawOutlinedRect( 0, 0, btnWidth, btnHeight )
                surface.DrawOutlinedRect( 1, 1, btnWidth-2, btnHeight-2 )
                surface.DrawOutlinedRect( 2, 2, btnWidth-4, btnHeight-4 )
                    end

--Builder Button

	    function button_builder:OnCursorEntered()
                button_builder:SetColor( textHoverColor )
                surface.PlaySound( "/UI/buttonrollover.wav" )
                modelButton:SetVisible(true)
				Description:SetText( desc_builder )
				Description:SizeToContents()				
            end
         
        function button_builder:OnCursorExited()
                button_builder:SetColor( textColor )
                modelButton:SetVisible(false)
				Description:SetText("Select a Team!")
				Description:SizeToContents()	
            end
         
        function button_builder:OnMousePress()
                surface.PlaySound( "/UI/buttonclick.wav" )
            end
			
			button_builder.Paint = function()
						surface.SetDrawColor( background )
						surface.DrawRect( 0, 0, btnWidth, btnHeight)
						surface.SetDrawColor( foreground )
						surface.DrawOutlinedRect( 0, 0, btnWidth, btnHeight )
						surface.DrawOutlinedRect( 1, 1, btnWidth-2, btnHeight-2 )
						surface.DrawOutlinedRect( 2, 2, btnWidth-4, btnHeight-4 )
					end
				
				
                button_builder.DoClick = function ()
				if LocalPlayer():IsAdmin() or LocalPlayer():IsUserGroup( "builder" ) then
					LocalPlayer():ConCommand("SetBuilder")
					LocalPlayer():ConCommand("say", "SetBuilder")
					surface.PlaySound( "/UI/buttonclickrelease.wav" )
					TeamSelection_Open = false
					Frame:Close()
					modelButton:SetVisible(false)
				else 
					notification.AddLegacy("You must be an Admin/Builder!", NOTIFY_ERROR, 5)
                end					
				end
					
					
					
end)

hook.Add("HUDPaint", "HNS_TeamSelect", function() 
	if TeamSelection_Open then
	
		--WideScreen Look
		local margin = .09
	    local variance = ScrH() * margin
	    surface.SetDrawColor( 0, 0, 0, 225 );
	    surface.DrawRect( 0, 0, ScrW(), ScrH() * margin )
	    surface.DrawRect( 0, ScrH() - variance +1, ScrW(), ScrH() * margin )	
	
	
		--The Main box/border.
		surface.SetDrawColor(modelbg);
	    surface.DrawRect( xPos +150, yPos, 650, 515)
	    surface.SetDrawColor(foreground)
	    surface.DrawOutlinedRect( xPos +150,yPos, 650, 515 )
		surface.DrawOutlinedRect( xPos +149,yPos -1, 652, 517 )
		draw.SimpleText( "TEAM SELECTION", "TeamHeader", ScrW() / 2 +2 , variance + 96, modelbg, TEXT_ALIGN_CENTER )
		draw.SimpleText( "TEAM SELECTION", "TeamHeader", ScrW() / 2, variance + 95, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
		--For the Objective window
	    surface.DrawOutlinedRect( xPos +160,yPos +380, 630, 125 )
	    surface.DrawOutlinedRect( xPos +159,yPos +379, 632, 127 )
	    surface.DrawOutlinedRect( xPos +160,yPos +380, 630, 25 )
	    surface.DrawOutlinedRect( xPos +159,yPos +379, 632, 27 )
		surface.SetTextPos( ScrW() / 2 -40, yPos +379 )
		surface.SetFont ( btnFont )
		surface.DrawText( "OBJECTIVE" )

	end
end)